package com.wao.information.domain;

import com.wao.base.domain.BaseMultitenantAuditingEntity;
import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * Information entity.
 *
 * @author Arthur.
 */
@ApiModel(description = "Information entity. @author Arthur.")
@Entity
@Table(name = "information_information")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Information extends BaseMultitenantAuditingEntity {

    private static final long serialVersionUID = 1L;

    @NotNull
    @Column(name = "name", nullable = false)
    private String name;

    @Column(name = "vice_title")
    private String viceTitle;

    @Column(name = "image")
    private String image;

    @Size(max = 2000)
    @Column(name = "description", length = 2000)
    private String description;

    @Lob
    @Column(name = "content")
    private String content;

    @Column(name = "keywords")
    private String keywords;

    @Column(name = "visits")
    private Integer visits;

    @Column(name = "source")
    private String source;

    @Column(name = "author")
    private String author;

    @NotNull
    @Column(name = "enabled", nullable = false)
    private Boolean enabled;

    @Column(name = "display_order")
    private Integer displayOrder;

    @Size(max = 8)
    @Column(name = "lang_key", length = 8)
    private String langKey;

    @NotNull
    @Column(name = "category_id", nullable = false)
    private Long categoryId;

    @Column(name = "publish_date")
    private ZonedDateTime publishDate;

    public String getName() {
        return name;
    }

    public Information name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getViceTitle() {
        return viceTitle;
    }

    public Information viceTitle(String viceTitle) {
        this.viceTitle = viceTitle;
        return this;
    }

    public void setViceTitle(String viceTitle) {
        this.viceTitle = viceTitle;
    }

    public String getImage() {
        return image;
    }

    public Information image(String image) {
        this.image = image;
        return this;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDescription() {
        return description;
    }

    public Information description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getContent() {
        return content;
    }

    public Information content(String content) {
        this.content = content;
        return this;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getKeywords() {
        return keywords;
    }

    public Information keywords(String keywords) {
        this.keywords = keywords;
        return this;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public Integer getVisits() {
        return visits;
    }

    public Information visits(Integer visits) {
        this.visits = visits;
        return this;
    }

    public void setVisits(Integer visits) {
        this.visits = visits;
    }

    public String getSource() {
        return source;
    }

    public Information source(String source) {
        this.source = source;
        return this;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getAuthor() {
        return author;
    }

    public Information author(String author) {
        this.author = author;
        return this;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Boolean isEnabled() {
        return enabled;
    }

    public Information enabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Integer getDisplayOrder() {
        return displayOrder;
    }

    public Information displayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
        return this;
    }

    public void setDisplayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
    }

    public String getLangKey() {
        return langKey;
    }

    public Information langKey(String langKey) {
        this.langKey = langKey;
        return this;
    }

    public void setLangKey(String langKey) {
        this.langKey = langKey;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Information categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public ZonedDateTime getPublishDate() {
        return publishDate;
    }

    public Information publishDate(ZonedDateTime publishDate) {
        this.publishDate = publishDate;
        return this;
    }

    public void setPublishDate(ZonedDateTime publishDate) {
        this.publishDate = publishDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Information information = (Information) o;
        if (information.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), information.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Information{" +
                "id=" + getId() +
                ", name='" + getName() + "'" +
                ", viceTitle='" + getViceTitle() + "'" +
                ", image='" + getImage() + "'" +
                ", description='" + getDescription() + "'" +
                ", content='" + getContent() + "'" +
                ", keywords='" + getKeywords() + "'" +
                ", visits='" + getVisits() + "'" +
                ", source='" + getSource() + "'" +
                ", author='" + getAuthor() + "'" +
                ", enabled='" + isEnabled() + "'" +
                ", displayOrder='" + getDisplayOrder() + "'" +
                ", langKey='" + getLangKey() + "'" +
                ", categoryId='" + getCategoryId() + "'" +
                ", publishDate='" + getPublishDate() + "'" +
                "}";
    }
}
